<?php
namespace app\account\middleware;
use think\facade\Cache;
class Check{
    public function handle($request, \Closure $next)
    {
        $token = $request->param('account_token/s','');
        if(empty($token)){
            return error('未登录',100);
        }
        $account_info = Cache::get('account_token_'.$token);
        
        if(empty($account_info)){
            return error('已掉线，请重新登录',100);
        }
        $request->account_info = $account_info;

        return $next($request);
    }
}